<template>
  <el-tag v-if="userInfo.companyStatus === 1" type="success" class="mr-8px">{{
    userInfo.companyName
  }}</el-tag>
  <router-link
    :to="`/applyAuth?userType=${userInfo.userType}`"
    class="inline-flex"
    v-if="showApplyBtn"
  >
    <el-button type="text" class="link py-0 h-20px">申请认证</el-button>
  </router-link>

  <el-tag type="warning" v-if="userInfo.companyStatus === -1">认证中</el-tag>
</template>

<script setup>
import { useUserStore } from "@/store";

const userStore = useUserStore();
const userInfo = computed(() => userStore?.userInfo || {});

const showApplyBtn = computed(
  () =>
    userInfo.value.companyStatus === -2 ||
    (userInfo.value.companyStatus === 1 && userInfo.value.userType >= 4)
);
</script>
